package com.blog.controller;

import com.blog.bean.FriendChain;
import com.blog.service.FriendChainService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class FriendChainController {

    @Resource
    private FriendChainService friendChainService;

    /**
     * 加载友链
     *
     * @param model
     * @return
     */
    @RequestMapping("/friendChain")
    public String friendChain(Model model) {
        FriendChain friendChain = new FriendChain();
        friendChain.setFriendChainState(0);
        List<FriendChain> friendChainList = friendChainService.selectFriendChain(friendChain);
        model.addAttribute("friendChainList", friendChainList);
        return "friend-chain";
    }
}
